﻿using PmSadis.Models.Abstract;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Collections.Generic;
using System;

namespace PmSadis.Models
{
    /// <summary>
    /// Генконтракт
    /// </summary>
    [Table("D_GEN_CONTRACT")]
    [MetadataType(typeof(GenContractMetadata))]
    public class GenContract : Contract
    {
        /// <summary>
        /// Идентификатор генконтракта
        /// </summary>
        public new int ContractId { get; set; }

        /// <summary>
        /// Номер генконтракта
        /// </summary>
        [Column("NUMBER")]
        [Required]
        public string Number { get; set; }
        
       /// <summary>
       /// Контракты генконтракта
       /// </summary>
        public virtual  ICollection<SubContract> SubContracts { get; set; }

        /// <summary>
        /// Генподрядчик генконтракта
        /// </summary>
        public virtual GenContractor GenContractor { get; set; }
    }

    sealed class GenContractMetadata : ContractMetadata
    {
        [Column("GEN_CONTRACT_ID")]
        [Key]
        public new int ContractId { get; set; }
    }
}
